#pragma once
#include "Utility/Algebra/sgEigenSpace.h"
#include "DataStructure/Common/Id.h"

#include "DBManager/DBServiceFactory.h"

#include "../Common/TaskExport.h"
/**
 * @brief    执行随机计算
 *
 * @param    dbServiceFactory 执行完频响分析的数据库
 * @param    subcaseIds       所有子工况
 * @return
 * @author   wanghuan
 * @date     2025.10.14
 */

class Task_DECLSPEC RandomRespSolver
{
public:
    static void Solve (const SG::DBManager::DBServiceFactorySP dbServiceFactory,
                                      SG::DataStructure::Common::IdArray      subcaseIds);


public:
    static SG::Algebra::Real_t TrapzIntegral (SG::Algebra::Real_t x0, SG::Algebra::Real_t x1, SG::Algebra::Real_t y0, SG::Algebra::Real_t y1);
    static SG::Algebra::Real_t LogLogIntegral (SG::Algebra::Real_t x0, SG::Algebra::Real_t x1, SG::Algebra::Real_t y0, SG::Algebra::Real_t y1);
    static void                ComputeRMSCurve (const std::vector<SG::Algebra::Real_t>& freq,
                                                const std::vector<SG::Algebra::Real_t>& psd,
                                                std::vector<SG::Algebra::Real_t>&       rms_curve,
                                                const std::string&                      IntegralMethod);
    static void                ComputeNumeberzero (const std::vector<SG::Algebra::Real_t>& freq,
                                                  const std::vector<SG::Algebra::Real_t>& psd,
                                                  SG::Algebra::Real_t&                    numberzero,
                                                  const std::string&                      IntegralMethod);


};